<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- saved from url=(0070)http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html -->
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script async="" type="text/javascript" src="./Scrapy入门教程_files/gpt.js"></script><script type="text/javascript" src="./Scrapy入门教程_files/encoder.js"></script>

<title>Scrapy入门教程 - 方倍工作室 - 博客园</title>
<link type="text/css" rel="stylesheet" href="./Scrapy入门教程_files/blog-common.css">
<link id="MainCss" type="text/css" rel="stylesheet" href="./Scrapy入门教程_files/style.css">
<link type="text/css" rel="stylesheet" href="./Scrapy入门教程_files/99079.css">
<link title="RSS" type="application/rss+xml" rel="alternate" href="http://www.cnblogs.com/txw1958/rss">
<link title="RSD" type="application/rsd+xml" rel="EditURI" href="http://www.cnblogs.com/txw1958/rsd.xml">
<link type="application/wlwmanifest+xml" rel="wlwmanifest" href="http://www.cnblogs.com/txw1958/wlwmanifest.xml">
<script src="./Scrapy入门教程_files/jquery.js" type="text/javascript"></script>  
<script type="text/javascript">var currentBlogApp = 'txw1958', cb_enable_mathjax=false;</script>
<script src="./Scrapy入门教程_files/blog-common.js" type="text/javascript"></script>
<script async="" type="text/javascript" src="./Scrapy入门教程_files/pubads_impl_38.js"></script><script type="text/javascript" async="" src="./Scrapy入门教程_files/embed.js" charset="UTF-8"></script><link type="text/css" rel="stylesheet" href="./Scrapy入门教程_files/embed.default.css"><script type="text/javascript" src="./Scrapy入门教程_files/osd.js"></script></head>
<body>
<a name="top"></a>

<div id="home">
<div id="header">
	<div id="blogTitle">
		
<!--done-->
<div class="title"><a id="Header1_HeaderTitle" class="headermaintitle" href="http://www.cnblogs.com/txw1958/">方倍工作室</a></div>
<div class="subtitle">微信公众平台开发 业务联系QQ：1354386063</div>



		
	</div><!--end: blogTitle 博客的标题和副标题 -->
	<div id="navigator">
		
<ul id="navList">
<li id="nav_sitehome"></li>
<li id="nav_myhome"><a id="MyLinks1_MyHomeLink" class="menu" href="http://www.cnblogs.com/txw1958/">首页</a></li>
<li id="nav_q"><a class="menu" href="http://q.cnblogs.com/">博问</a></li>
<li id="nav_ing"><a class="menu" href="http://home.cnblogs.com/ing/">闪存</a></li>
<li id="nav_newpost"><a id="MyLinks1_NewPostLink" class="menu" rel="nofollow" href="http://i.cnblogs.com/EditPosts.aspx?opt=1">新随笔</a></li>
<li id="nav_contact"><a id="MyLinks1_ContactLink" class="menu" rel="nofollow" href="http://space.cnblogs.com/msg/send/%e6%96%b9%e5%80%8d%e5%b7%a5%e4%bd%9c%e5%ae%a4">联系</a></li>
<li id="nav_rss">
<!----></li>
<li id="nav_admin"><a id="MyLinks1_Admin" class="menu" rel="nofollow" href="http://i.cnblogs.com/">管理</a></li>
</ul>

		<div class="blogStats">
			
			
<!--done-->
随笔-442&nbsp;
文章-6&nbsp;
评论-716&nbsp;

			
		</div><!--end: blogStats -->
	</div><!--end: navigator 博客导航栏 -->
</div><!--end: header 头部 -->
<div id="main">
	<div id="mainContent">
	<div class="forFlow">
		

<!--done-->
<div id="topics">
	<div class="post">
		<h1 class="postTitle">
			<a id="cb_post_title_url" class="postTitle2" href="./Scrapy入门教程_files/Scrapy入门教程.htm">Scrapy入门教程</a>
		</h1>
		<div class="clear"></div>
		<div class="postBody">
			<div id="cnblogs_post_body"><p>关键字：<strong>scrapy</strong> <strong>入门教程</strong> <strong>爬虫</strong> <strong>Spider</strong><br>作者：<a href="http://www.cnblogs.com/txw1958/" target="_blank">http://www.cnblogs.com/txw1958/</a><br>出处：<a href="./Scrapy入门教程_files/Scrapy入门教程.htm">http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html</a> </p>
<p>&nbsp;</p>
<p>在这篇入门教程中，我们假定你已经安装了Scrapy。如果你还没有安装，那么请参考<a href="http://www.cnblogs.com/txw1958/archive/2012/07/12/scrapy_installation_introduce.html" target="_parent">安装指南</a>。</p>
<p>我们将使用开放目录项目(dmoz)作为抓取的例子。</p>
<p>这篇入门教程将引导你完成如下任务：</p>
<ol>
<li>创建一个新的Scrapy项目</li>
<li>定义提取的Item</li>
<li>写一个Spider用来爬行站点，并提取Items</li>
<li>写一个Item Pipeline用来存储提取出的Items</li>






</ol>
<p>Scrapy是由Python编写的。如果你是Python新手，你也许希望从了解Python开始，以期最好的使用Scrapy。如果你对其它编程语言熟悉，想快速的学习Python，这里推荐 <span style="color: #0000ff;"><a href="http://book.doucube.com/diveintopython3/" target="_blank"><span style="color: #0000ff;">Dive Into Python</span></a></span>。如果你对编程是新手，且想从Python开始学习编程，请看下面的<a href="http://blog.csdn.net/bjfuzhao/article/details/%20Dive%20Into%20Python" target="_blank">对非程序员的Python资源列表</a>。</p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>新建工程</strong></span></p>
<p>在抓取之前，你需要新建一个Scrapy工程。进入一个你想用来保存代码的目录，然后执行：</p>
<div class="cnblogs_code">
<pre>Microsoft Windows XP [Version 5.1.2600<span style="color: #000000;">]
</span>(C) Copyright 1985-2001 Microsoft Corp.<span style="color: #000000;">

T:</span>\&gt;<span style="color: #000000;">scrapy startproject tutorial
T:</span>\&gt;</pre>
</div>
<p>这个命令会在当前目录下创建一个新目录tutorial，它的结构如下：</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre>T:\tutorial&gt;<span style="color: #0000ff;">tree</span> /<span style="color: #000000;">f
Folder </span><span style="color: #0000ff;">PATH</span><span style="color: #000000;"> listing
Volume serial number is 0006EFCF C86A:7C52
T:</span>.<span style="color: #000000;">
│  scrapy</span>.<span style="color: #000000;">cfg
│
└─tutorial
    │  items</span>.<span style="color: #000000;">py
    │  pipelines</span>.<span style="color: #000000;">py
    │  settings</span>.<span style="color: #000000;">py
    │  __init__</span>.<span style="color: #000000;">py
    │
    └─spiders
            __init__</span>.py</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>这些文件主要是：</p>
<ul>
<li>scrapy.cfg: 项目配置文件</li>
<li>tutorial/: 项目python模块, 呆会代码将从这里导入</li>
<li>tutorial/items.py: 项目items文件</li>
<li>tutorial/pipelines.py: 项目管道文件</li>
<li>tutorial/settings.py: 项目配置文件</li>
<li>tutorial/spiders: 放置spider的目录</li>
</ul>
<p>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>定义</strong><strong>Item</strong></span></p>
<p>Items是将要装载抓取的数据的容器，它工作方式像python里面的字典，但它提供更多的保护，比如对未定义的字段填充以防止拼写错误。</p>
<p>它通过创建一个scrapy.item.Item类来声明，定义它的属性为scrpy.item.Field对象，就像是一个对象关系映射(ORM). <br>我们通过将需要的item模型化，来控制从dmoz.org获得的站点数据，比如我们要获得站点的名字，url和网站描述，我们定义这三种属性的域。要做到这点，我们编辑在tutorial目录下的items.py文件，我们的Item类将会是这样</p>
<div class="cnblogs_code">
<pre><span style="color: #0000ff;">from</span> scrapy.item <span style="color: #0000ff;">import</span><span style="color: #000000;"> Item, Field 
</span><span style="color: #0000ff;">class</span><span style="color: #000000;"> DmozItem(Item):
    title </span>=<span style="color: #000000;"> Field()
    link </span>=<span style="color: #000000;"> Field()
&nbsp;&nbsp;&nbsp; desc </span>= Field()</pre>
</div>
<p>刚开始看起来可能会有些困惑，但是定义这些item能让你用其他Scrapy组件的时候知道你的 items到底是什么。</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>我们的第一个爬虫</strong><strong>(Spider)</strong></span></p>
<p>Spider是用户编写的类，用于从一个域（或域组）中抓取信息。</p>
<p>他们定义了用于下载的URL的初步列表，如何跟踪链接，以及如何来解析这些网页的内容用于提取items。</p>
<p>要建立一个Spider，你必须为scrapy.spider.BaseSpider创建一个子类，并确定三个主要的、强制的属性：</p>
<ul>
<li>name：爬虫的识别名，它必须是唯一的，在不同的爬虫中你必须定义不同的名字.</li>
<li>start_urls：爬虫开始爬的一个URL列表。爬虫从这里开始抓取数据，所以，第一次下载的数据将会从这些URLS开始。其他子URL将会从这些起始URL中继承性生成。</li>
<li>parse()：爬虫的方法，调用时候传入从每一个URL传回的Response对象作为参数，response将会是parse方法的唯一的一个参数,</li>
</ul>
<p>这个方法负责解析返回的数据、匹配抓取的数据(解析为item)并跟踪更多的URL。</p>
<p>&nbsp;</p>
<p>这是我们的第一只爬虫的代码，将其命名为dmoz_spider.py并保存在tutorial\spiders目录下。</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #0000ff;">from</span> scrapy.spider <span style="color: #0000ff;">import</span><span style="color: #000000;"> BaseSpider

</span><span style="color: #0000ff;">class</span><span style="color: #000000;"> DmozSpider(BaseSpider):
    name </span>= <span style="color: #800000;">"</span><span style="color: #800000;">dmoz</span><span style="color: #800000;">"</span><span style="color: #000000;">
    allowed_domains </span>= [<span style="color: #800000;">"</span><span style="color: #800000;">dmoz.org</span><span style="color: #800000;">"</span><span style="color: #000000;">]
    start_urls </span>=<span style="color: #000000;"> [
        </span><span style="color: #800000;">"</span><span style="color: #800000;">http://www.dmoz.org/Computers/Programming/Languages/Python/Books/</span><span style="color: #800000;">"</span><span style="color: #000000;">,
        </span><span style="color: #800000;">"</span><span style="color: #800000;">http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/</span><span style="color: #800000;">"</span><span style="color: #000000;">
    ]

    </span><span style="color: #0000ff;">def</span><span style="color: #000000;"> parse(self, response):
        filename </span>= response.url.split(<span style="color: #800000;">"</span><span style="color: #800000;">/</span><span style="color: #800000;">"</span>)[-2<span style="color: #000000;">]
        open(filename, </span><span style="color: #800000;">'</span><span style="color: #800000;">wb</span><span style="color: #800000;">'</span>).write(response.body)</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>爬爬爬</strong></span></p>
<p>为了让我们的爬虫工作，我们返回项目主目录执行以下命令</p>
<div class="cnblogs_code">
<pre>T:\tutorial&gt;scrapy crawl dmoz</pre>
</div>
<p>crawl dmoz 命令从dmoz.org域启动爬虫。 你将会获得如下类似输出&nbsp;</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre>T:\tutorial&gt;<span style="color: #000000;">scrapy crawl dmoz
</span>2012-07-13 19:14:45+0800 [scrapy] INFO: Scrapy 0.14.4 started (bot: tutorial)
2012-07-13 19:14:45+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Enabled extensions: LogStats, TelnetConsole, CloseSpider, WebService, CoreStats,<span style="color: #000000;"> SpiderState
</span>2012-07-13 19:14:45+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, UserAgentMiddleware, RetryMiddleware, DefaultHeadersMiddleware, RedirectMiddleware, CookiesMiddleware, HttpCompressionMiddleware, ChunkedTransferMiddleware,<span style="color: #000000;"> DownloaderStats
</span>2012-07-13 19:14:45+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware,<span style="color: #000000;"> DepthMiddleware
</span>2012-07-13 19:14:45+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span><span style="color: #000000;">: Enabled item pipelines:
</span>2012-07-13 19:14:45+0800<span style="color: #000000;"> [dmoz] INFO: Spider opened
</span>2012-07-13 19:14:45+0800 [dmoz] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2012-07-13 19:14:45+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Telnet console listening <span style="color: #0000ff;">on</span> 0.0.0.0:6023
2012-07-13 19:14:45+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Web service listening <span style="color: #0000ff;">on</span> 0.0.0.0:6080
2012-07-13 19:14:46+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Crawled (200) &lt;GET http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/&gt; (referer: None)
2012-07-13 19:14:46+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Crawled (200) &lt;GET http://www.dmoz.org/Computers/Programming/Languages/Python/Books/&gt; (referer: None)
2012-07-13 19:14:46+0800 [dmoz] INFO: Closing spider (finished)
2012-07-13 19:14:46+0800<span style="color: #000000;"> [dmoz] INFO: Dumping spider stats:
        {'downloader</span>/request_bytes': 486,<span style="color: #000000;">
         'downloader</span>/request_count': 2,<span style="color: #000000;">
         'downloader</span>/request_method_count/GET': 2,<span style="color: #000000;">
         'downloader</span>/response_bytes': 13063,<span style="color: #000000;">
         'downloader</span>/response_count': 2,<span style="color: #000000;">
         'downloader</span>/response_status_count/200': 2,<span style="color: #000000;">
         'finish_reason': 'finished'</span>,<span style="color: #000000;">
         'finish_time': datetime</span>.datetime(2012, 7, 13, 11, 14, 46, 703000),<span style="color: #000000;">
         'scheduler</span>/memory_enqueued': 2,<span style="color: #000000;">
         'start_time': datetime</span>.datetime(2012, 7, 13, 11, 14, 45, 500000)<span style="color: #000000;">}
</span>2012-07-13 19:14:46+0800 [dmoz] INFO: Spider closed (finished)
2012-07-13 19:14:46+0800<span style="color: #000000;"> [scrapy] INFO: Dumping global stats:
        {}</span></pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>注意包含 [dmoz]的行 ，那对应着我们的爬虫。你可以看到start_urls中定义的每个URL都有日志行。因为这些URL是起始页面，所以他们没有引用(referrers)，所以在每行的末尾你会看到 (referer: &lt;None&gt;). <br>有趣的是，在我们的 parse&nbsp; 方法的作用下，两个文件被创建：分别是 Books 和 Resources，这两个文件中有URL的页面内容。 <br><br><strong>发生了什么事情</strong><strong>?</strong></p>
<p>Scrapy为爬虫的 start_urls属性中的每个URL创建了一个 scrapy.http.Request 对象 ，并将爬虫的parse 方法指定为回调函数。 <br>这些 Request首先被调度，然后被执行，之后通过parse()方法，scrapy.http.Response 对象被返回，结果也被反馈给爬虫。</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>提取</strong><strong>Item</strong></span></p>
<p><strong>选择器介绍</strong></p>
<p>我们有很多方法从网站中提取数据。Scrapy 使用一种叫做 XPath selectors的机制，它基于 XPath表达式。如果你想了解更多selectors和其他机制你可以查阅资料http://doc.scrapy.org/topics/selectors.html#topics-selectors <br>这是一些XPath表达式的例子和他们的含义 </p>
<ul>
<li>/html/head/title: 选择HTML文档&lt;head&gt;元素下面的&lt;title&gt; 标签。 </li>
<li>/html/head/title/text(): 选择前面提到的&lt;title&gt; 元素下面的文本内容</li>
<li>//td: 选择所有 &lt;td&gt; 元素</li>
<li>//div[@class="mine"]: 选择所有包含 class="mine" 属性的div 标签元素</li>






</ul>
<p>这只是几个使用XPath的简单例子，但是实际上XPath非常强大。如果你想了解更多XPATH的内容，我们向你推荐这个XPath教程<a href="http://www.w3schools.com/XPath/default.asp">http://www.w3schools.com/XPath/default.asp</a></p>
<p>为了方便使用XPaths，Scrapy提供XPathSelector 类， 有两种口味可以选择， HtmlXPathSelector (HTML数据解析) 和XmlXPathSelector (XML数据解析)。 为了使用他们你必须通过一个 Response 对象对他们进行实例化操作。你会发现Selector对象展示了文档的节点结构。因此，第一个实例化的selector必与根节点或者是整个目录有关 。 <br>Selectors 有三种方法</p>
<ul>
<li>path()：返回selectors列表, 每一个select表示一个xpath参数表达式选择的节点.</li>
<li>extract()：返回一个unicode字符串，该字符串为XPath选择器返回的数据</li>
<li>re()： 返回unicode字符串列表，字符串作为参数由正则表达式提取出来</li>






</ul>
<p><strong>尝试在</strong><strong>shell</strong><strong>中使用</strong><strong>Selectors</strong></p>
<p>为了演示Selectors的用法，我们将用到 内建的Scrapy shell，这需要系统已经安装IPython (一个扩展python交互环境) 。 </p>
<p>附IPython下载地址：<a href="http://pypi.python.org/pypi/ipython#downloads">http://pypi.python.org/pypi/ipython#downloads</a></p>
<p>要开始shell，首先进入项目顶层目录，然后输入 </p>
<div class="cnblogs_code">
<pre>T:\tutorial&gt;scrapy <span style="color: #0000ff;">shell</span> http://www.dmoz.org/Computers/Programming/Languages/Python/Books/</pre>
</div>
<p>输出结果类似这样：</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre>2012-07-16 10:58:13+0800 [scrapy] INFO: Scrapy 0.14.4 started (bot: tutorial)
2012-07-16 10:58:13+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Enabled extensions: TelnetConsole, CloseSpider, WebService, CoreStats,<span style="color: #000000;"> SpiderState
</span>2012-07-16 10:58:13+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Enabled downloader middlewares: HttpAuthMiddleware, DownloadTimeoutMiddleware, UserAgentMiddleware, RetryMiddleware, DefaultHeadersMiddleware, RedirectMiddleware, CookiesMiddleware, HttpCompressionMiddleware, ChunkedTransferMiddleware,<span style="color: #000000;"> DownloaderStats
</span>2012-07-16 10:58:13+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Enabled spider middlewares: HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware,<span style="color: #000000;"> DepthMiddleware
</span>2012-07-16 10:58:13+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span><span style="color: #000000;">: Enabled item pipelines:
</span>2012-07-16 10:58:13+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Telnet console listening <span style="color: #0000ff;">on</span> 0.0.0.0:6023
2012-07-16 10:58:13+0800 [scrapy] <span style="color: #0000ff;">DEBUG</span>: Web service listening <span style="color: #0000ff;">on</span> 0.0.0.0:6080
2012-07-16 10:58:13+0800<span style="color: #000000;"> [dmoz] INFO: Spider opened
</span>2012-07-16 10:58:18+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Crawled (200) &lt;GET http://www.dmoz.org/Computers/Programming/Languages/Python/Books/&gt; (referer: None)<span style="color: #000000;">
[s] Available Scrapy objects:
[s]   hxs        </span>&lt;HtmlXPathSelector xpath=None data=u'&lt;html&gt;&lt;head&gt;&lt;meta http-equiv="<span style="color: #000000;">Content-Ty'&gt;
[s]   item       {}
[s]   request    &lt;GET http://www.dmoz.org/Computers/Programming/Languages/Python/Books/&gt;
[s]   response   &lt;200 http://www.dmoz.org/Computers/Programming/Languages/Python/Books/&gt;
[s]   settings   &lt;CrawlerSettings module=&lt;module 'tutorial.settings' from 'T:\tutorial\tutorial\settings.pyc'&gt;&gt;
[s]   spider     &lt;DmozSpider 'dmoz' at 0x1f68230&gt;
[s] Useful shortcuts:
[s]   shelp()           Shell help (print this help)
[s]   fetch(req_or_url) Fetch request (or URL) and update local objects
[s]   view(response)    View response in a browser
WARNING: Readline services not available or not loaded.WARNING: Proper color support under MS Windows requires the pyreadline library.
You can find it at:
http://ipython.org/pyreadline.html
Gary's readline needs the ctypes module, from:
http://starship.python.net/crew/theller/ctypes
(Note that ctypes is already part of Python versions 2.5 and newer).

Defaulting color scheme to 'NoColor'Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]
Type </span>"copyright", "credits" or "license"<span style="color: #000000;"> for more information.

IPython 0.13 -- An enhanced Interactive Python.
?         -&gt; Introduction and overview of IPython's features.
%quickref -&gt; Quick reference.
help      -&gt; Python's own help system.
object?   -&gt; Details about 'object', use 'object??' for extra details.

In [1]:</span></pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>Shell载入后，你将获得回应，这些内容被存储在本地变量 response 中，所以如果你输入response.body 你将会看到response的body部分，或者输入response.headers 来查看它的 header部分。 <br>Shell也实例化了两种selectors，一个是解析HTML的&nbsp; hxs 变量，一个是解析 XML 的 xxs 变量。我们来看看里面有什么：</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre>In [1]: hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//title</span><span style="color: #800000;">'</span><span style="color: #000000;">)
Out[</span>1]: [&lt;HtmlXPathSelector xpath=<span style="color: #800000;">'</span><span style="color: #800000;">//title</span><span style="color: #800000;">'</span> data=u<span style="color: #800000;">'</span><span style="color: #800000;">&lt;title&gt;Open Directory - Computers: Progr</span><span style="color: #800000;">'</span>&gt;<span style="color: #000000;">]

In [</span>2]: hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//title</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
Out[</span>2]: [u<span style="color: #800000;">'</span><span style="color: #800000;">&lt;title&gt;Open Directory - Computers: Programming: Languages: Python: Books&lt;/title&gt;</span><span style="color: #800000;">'</span><span style="color: #000000;">]

In [</span>3]: hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//title/text()</span><span style="color: #800000;">'</span><span style="color: #000000;">)
Out[</span>3]: [&lt;HtmlXPathSelector xpath=<span style="color: #800000;">'</span><span style="color: #800000;">//title/text()</span><span style="color: #800000;">'</span> data=u<span style="color: #800000;">'</span><span style="color: #800000;">Open Directory - Computers: Programming:</span><span style="color: #800000;">'</span>&gt;<span style="color: #000000;">]

In [</span>4]: hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//title/text()</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
Out[</span>4]: [u<span style="color: #800000;">'</span><span style="color: #800000;">Open Directory - Computers: Programming: Languages: Python: Books</span><span style="color: #800000;">'</span><span style="color: #000000;">]

In [</span>5]: hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//title/text()</span><span style="color: #800000;">'</span>).re(<span style="color: #800000;">'</span><span style="color: #800000;">(\w+):</span><span style="color: #800000;">'</span><span style="color: #000000;">)
Out[</span>5]: [u<span style="color: #800000;">'</span><span style="color: #800000;">Computers</span><span style="color: #800000;">'</span>, u<span style="color: #800000;">'</span><span style="color: #800000;">Programming</span><span style="color: #800000;">'</span>, u<span style="color: #800000;">'</span><span style="color: #800000;">Languages</span><span style="color: #800000;">'</span>, u<span style="color: #800000;">'</span><span style="color: #800000;">Python</span><span style="color: #800000;">'</span><span style="color: #000000;">]

In [</span>6]:</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>提取数据</strong></span></p>
<p>现在我们尝试从网页中提取数据。 <br>你可以在控制台输入 response.body， 检查源代码中的 XPaths 是否与预期相同。然而，检查HTML源代码是件很枯燥的事情。为了使事情变得简单，我们使用Firefox的扩展插件Firebug。更多信息请查看<em><a href="http://doc.scrapy.org/en/0.14/topics/firebug.html#topics-firebug">Using Firebug for scraping</a> </em><em>和</em><em><a href="http://doc.scrapy.org/en/0.14/topics/firefox.html#topics-firefox">Using Firefox for scraping</a>.</em><br>txw1958注：事实上我用的是Google Chrome的Inspect Element功能，而且可以提取元素的XPath。<br>检查源代码后，你会发现我们需要的数据在一个 &lt;ul&gt;元素中，而且是第二个&lt;ul&gt;。 <br>我们可以通过如下命令选择每个在网站中的 &lt;li&gt; 元素: </p>
<div class="cnblogs_code">
<pre>hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//ul/li</span><span style="color: #800000;">'</span>) </pre>
</div>
<p>然后是网站描述:</p>
<div class="cnblogs_code">
<pre>hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//ul/li/text()</span><span style="color: #800000;">'</span>).extract()</pre>
</div>
<p>网站标题:</p>
<div class="cnblogs_code">
<pre>hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//ul/li/a/text()</span><span style="color: #800000;">'</span>).extract()</pre>
</div>
<p>网站链接:</p>
<div class="cnblogs_code">
<pre>hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//ul/li/a/@href</span><span style="color: #800000;">'</span>).extract()</pre>
</div>
<p>如前所述，每个path()调用返回一个selectors列表，所以我们可以结合path()去挖掘更深的节点。我们将会用到这些特性，所以:</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre>sites = hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//ul/li</span><span style="color: #800000;">'</span><span style="color: #000000;">)
</span><span style="color: #0000ff;">for</span> site <span style="color: #0000ff;">in</span><span style="color: #000000;"> sites:
    title </span>= site.path(<span style="color: #800000;">'</span><span style="color: #800000;">a/text()</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
    link </span>= site.path(<span style="color: #800000;">'</span><span style="color: #800000;">a/@href</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
    desc </span>= site.path(<span style="color: #800000;">'</span><span style="color: #800000;">text()</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
    </span><span style="color: #0000ff;">print</span> title, link, desc</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>&nbsp;</p>
<p>Note <br>更多关于嵌套选择器的内容，请阅读<a href="http://doc.scrapy.org/en/0.14/topics/selectors.html#topics-selectors-nesting-selectors"><em>Nesting selectors</em></a> 和 <a href="http://doc.scrapy.org/en/0.14/topics/selectors.html#topics-selectors-relative-xpaths"><em>Working with relative XPaths</em></a></p>
<p>将代码添加到爬虫中： </p>
<p>txw1958注：代码有修改，绿色注释掉的代码为原教程的，你懂的</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #0000ff;">from</span> scrapy.spider <span style="color: #0000ff;">import</span><span style="color: #000000;"> BaseSpider
</span><span style="color: #0000ff;">from</span> scrapy.selector <span style="color: #0000ff;">import</span><span style="color: #000000;"> HtmlXPathSelector

</span><span style="color: #0000ff;">class</span><span style="color: #000000;"> DmozSpider(BaseSpider):
    name </span>= <span style="color: #800000;">"</span><span style="color: #800000;">dmoz</span><span style="color: #800000;">"</span><span style="color: #000000;">
    allowed_domains </span>= [<span style="color: #800000;">"</span><span style="color: #800000;">dmoz.org</span><span style="color: #800000;">"</span><span style="color: #000000;">]
    start_urls </span>=<span style="color: #000000;"> [
        </span><span style="color: #800000;">"</span><span style="color: #800000;">http://www.dmoz.org/Computers/Programming/Languages/Python/Books/</span><span style="color: #800000;">"</span><span style="color: #000000;">,
        </span><span style="color: #800000;">"</span><span style="color: #800000;">http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/</span><span style="color: #800000;">"</span><span style="color: #000000;">
]    
  
    </span><span style="color: #0000ff;">def</span><span style="color: #000000;"> parse(self, response):
        hxs </span>=<span style="color: #000000;"> HtmlXPathSelector(response)
        sites </span>= hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//fieldset/ul/li</span><span style="color: #800000;">'</span><span style="color: #000000;">)
        </span><span style="color: #008000;">#</span><span style="color: #008000;">sites = hxs.path('//ul/li')</span>
        <span style="color: #0000ff;">for</span> site <span style="color: #0000ff;">in</span><span style="color: #000000;"> sites:
            title </span>= site.path(<span style="color: #800000;">'</span><span style="color: #800000;">a/text()</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
            link </span>= site.path(<span style="color: #800000;">'</span><span style="color: #800000;">a/@href</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
            desc </span>= site.path(<span style="color: #800000;">'</span><span style="color: #800000;">text()</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
            </span><span style="color: #008000;">#</span><span style="color: #008000;">print title, link, desc</span>
            <span style="color: #0000ff;">print</span> title, link</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>现在我们再次抓取dmoz.org，你将看到站点在输出中被打印 ，运行命令</p>
<div class="cnblogs_code">
<pre>T:\tutorial&gt;scrapy crawl dmoz</pre>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>使用条目</strong><strong>(Item)</strong></span></p>
<p>Item 对象是自定义的python字典，使用标准字典类似的语法，你可以获取某个字段(即之前定义的类的属性)的值:</p>
<div class="cnblogs_code">
<pre>&gt;&gt;&gt; item =<span style="color: #000000;"> DmozItem() 
</span>&gt;&gt;&gt; item[<span style="color: #800000;">'</span><span style="color: #800000;">title</span><span style="color: #800000;">'</span>] = <span style="color: #800000;">'</span><span style="color: #800000;">Example title</span><span style="color: #800000;">'</span> 
&gt;&gt;&gt; item[<span style="color: #800000;">'</span><span style="color: #800000;">title</span><span style="color: #800000;">'</span><span style="color: #000000;">] 
</span><span style="color: #800000;">'</span><span style="color: #800000;">Example title</span><span style="color: #800000;">'</span> </pre>
</div>
<p>Spiders希望将其抓取的数据存放到Item对象中。为了返回我们抓取数据，spider的最终代码应当是这样:</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre><span style="color: #0000ff;">from</span> scrapy.spider <span style="color: #0000ff;">import</span><span style="color: #000000;"> BaseSpider
</span><span style="color: #0000ff;">from</span> scrapy.selector <span style="color: #0000ff;">import</span><span style="color: #000000;"> HtmlXPathSelector

</span><span style="color: #0000ff;">from</span> tutorial.items <span style="color: #0000ff;">import</span><span style="color: #000000;"> DmozItem

</span><span style="color: #0000ff;">class</span><span style="color: #000000;"> DmozSpider(BaseSpider):
   name </span>= <span style="color: #800000;">"</span><span style="color: #800000;">dmoz</span><span style="color: #800000;">"</span><span style="color: #000000;">
   allowed_domains </span>= [<span style="color: #800000;">"</span><span style="color: #800000;">dmoz.org</span><span style="color: #800000;">"</span><span style="color: #000000;">]
   start_urls </span>=<span style="color: #000000;"> [
       </span><span style="color: #800000;">"</span><span style="color: #800000;">http://www.dmoz.org/Computers/Programming/Languages/Python/Books/</span><span style="color: #800000;">"</span><span style="color: #000000;">,
       </span><span style="color: #800000;">"</span><span style="color: #800000;">http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/</span><span style="color: #800000;">"</span><span style="color: #000000;">
   ]

   </span><span style="color: #0000ff;">def</span><span style="color: #000000;"> parse(self, response):
       hxs </span>=<span style="color: #000000;"> HtmlXPathSelector(response)
       sites </span>= hxs.path(<span style="color: #800000;">'</span><span style="color: #800000;">//fieldset/ul/li</span><span style="color: #800000;">'</span><span style="color: #000000;">)
       </span><span style="color: #008000;">#</span><span style="color: #008000;">sites = hxs.path('//ul/li')</span>
       items =<span style="color: #000000;"> []
       </span><span style="color: #0000ff;">for</span> site <span style="color: #0000ff;">in</span><span style="color: #000000;"> sites:
           item </span>=<span style="color: #000000;"> DmozItem()
           item[</span><span style="color: #800000;">'</span><span style="color: #800000;">title</span><span style="color: #800000;">'</span>] = site.path(<span style="color: #800000;">'</span><span style="color: #800000;">a/text()</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
           item[</span><span style="color: #800000;">'</span><span style="color: #800000;">link</span><span style="color: #800000;">'</span>] = site.path(<span style="color: #800000;">'</span><span style="color: #800000;">a/@href</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
           item[</span><span style="color: #800000;">'</span><span style="color: #800000;">desc</span><span style="color: #800000;">'</span>] = site.path(<span style="color: #800000;">'</span><span style="color: #800000;">text()</span><span style="color: #800000;">'</span><span style="color: #000000;">).extract()
           items.append(item)
       </span><span style="color: #0000ff;">return</span> items</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p>现在我们再次抓取 :&nbsp;</p>
<div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div>
<pre>2012-07-16 14:52:36+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Scraped from &lt;200 http://www.dmoz.org/Computers/Programming/Languages/Python/Books/&gt;<span style="color: #000000;">
        {'desc': [u'</span>\n\t\t\t\n\t',<span style="color: #000000;">
                  u' </span>\n\t\t\t\n\t\t\t\t\t\n - Free Python books and tutorials.\n \n'],<span style="color: #000000;">
         'link': [u'http:</span>//www.techbooksforfree.com/perlpython.shtml'],<span style="color: #000000;">
         'title': [u'Free Python books']}
</span>2012-07-16 14:52:36+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Scraped from &lt;200 http://www.dmoz.org/Computers/Programming/Languages/Python/Books/&gt;<span style="color: #000000;">
        {'desc': [u'</span>\n\t\t\t\n\t',<span style="color: #000000;">
                  u' </span>\n\t\t\t\n\t\t\t\t\t\n - Annotated list of free online books <span style="color: #0000ff;">on</span> Python scripting language. Topics range from beginner to advanced.\n \<span style="color: #000000;">n
          ']</span>,<span style="color: #000000;">
         'link': [u'http:</span>//www.freetechbooks.com/python-f6.html'],<span style="color: #000000;">
         'title': [u'FreeTechBooks: Python Scripting Language']}
</span>2012-07-16 14:52:36+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Crawled (200) &lt;GET http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/&gt; (referer: None)
2012-07-16 14:52:36+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Scraped from &lt;200 http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/&gt;<span style="color: #000000;">
        {'desc': [u'</span>\n\t\t\t\n\t',<span style="color: #000000;">
                  u' </span>\n\t\t\t\n\t\t\t\t\t\n - A directory of free Python and Zope hosting providers, with reviews and ratings.\n \n'],<span style="color: #000000;">
         'link': [u'http:</span>//www.oinko.<span style="color: #0000ff;">net</span>/freepython/'],<span style="color: #000000;">
         'title': [u'Free Python and Zope Hosting Directory']}
</span>2012-07-16 14:52:36+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Scraped from &lt;200 http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/&gt;<span style="color: #000000;">
        {'desc': [u'</span>\n\t\t\t\n\t',<span style="color: #000000;">
                  u' </span>\n\t\t\t\n\t\t\t\t\t\n - Features Python books, resources, news and articles.\n \n'],<span style="color: #000000;">
         'link': [u'http:</span>//oreilly.com/python/'],<span style="color: #000000;">
         'title': [u</span>"O'Reilly Python Center"<span style="color: #000000;">]}
</span>2012-07-16 14:52:36+0800 [dmoz] <span style="color: #0000ff;">DEBUG</span>: Scraped from &lt;200 http://www.dmoz.org/Computers/Programming/Languages/Python/Resources/&gt;<span style="color: #000000;">
        {'desc': [u'</span>\n\t\t\t\n\t',<span style="color: #000000;">
                  u' </span>\n\t\t\t\n\t\t\t\t\t\n - Resources <span style="color: #0000ff;">for</span> reporting bugs, accessing the Python source <span style="color: #0000ff;">tree</span> with CVS and taking part in the development of Python.\n\n'],<span style="color: #000000;">
         'link': [u'http:</span>//www.python.org/dev/'],<span style="color: #000000;">
         'title': [u</span>"Python Developer's Guide"]}</pre>
<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="复制代码"><img src="./Scrapy入门教程_files/copycode.gif" alt="复制代码"></a></span></div></div>
<p><br>&nbsp;</p>
<p><span style="font-size: 18pt;"><strong>保存抓取的数据</strong></span></p>
<p>保存信息的最简单的方法是通过<a href="http://doc.scrapy.org/en/0.14/topics/feed-exports.html#topics-feed-exports"><em>Feed exports</em></a>，命令如下：</p>
<div class="cnblogs_code">
<pre>T:\tutorial&gt;scrapy crawl dmoz -o items.json -t json</pre>
</div>
<p>所有抓取的items将以JSON格式被保存在新生成的items.json 文件中<br><br>在像本教程一样的小型项目中，这些已经足够。然而，如果你想用抓取的items做更复杂的事情，你可以写一个 Item Pipeline(条目管道)。因为在项目创建的时候，一个专门用于条目管道的占位符文件已经随着items一起被建立，目录在tutorial/pipelines.py。如果你只需要存取这些抓取后的items的话，就不需要去实现任何的条目管道。</p>
<p><br><br><span style="font-size: 18pt;"><strong>结束语</strong></span></p>
<p>本教程简要介绍了Scrapy的使用，但是许多其他特性并没有提及。</p>
<p>对于基本概念的了解，请访问<a href="http://doc.scrapy.org/en/0.14/index.html#section-basics"><em>Basic concepts</em></a></p>
<p>我们推荐你继续学习Scrapy项目的例子dirbot，你将从中受益更深，该项目包含本教程中提到的dmoz爬虫。</p>
<p>Dirbot项目位于<a href="https://github.com/scrapy/dirbot">https://github.com/scrapy/dirbot</a></p>
<p>项目包含一个README文件，它详细描述了项目的内容。</p>
<p>如果你熟悉git，你可以checkout它的源代码。或者你可以通过点击Downloads下载tarball或zip格式的文件。</p>
<p>另外这有一个代码片断共享网站，里面共享内容包括爬虫，中间件，扩展应用，脚本等。网站名字叫<a href="http://snippets.scrapy.org/">Scrapy snippets</a>，有好的代码要记得共享哦:-)</p>
<p>&nbsp;</p>
<p>本教程的源代码下载：<a href="http://files.cnblogs.com/txw1958/scrapy_tutorial.rar">http://files.cnblogs.com/txw1958/scrapy_tutorial.rar</a></p>
<p>&nbsp;</p>
<p>欢迎关注<strong>方倍工作室</strong>微信，了解我们及行业的最新动态</p>
<p><img src="./Scrapy入门教程_files/18163732-021ec79880b2424898b74d7d8de62686.jpg" alt=""></p>
<p>&nbsp;</p>
<p>&nbsp;</p></div><div id="MySignature"><p>====================================================================</p>
<a style="color: #0000C6;" href="http://israel.sinaapp.com/trace/signature.php?entity=tutorial" target="_blank"><strong>★学习微信公众平台开发入门教程 点击进入</strong></a>
<a style="color: #7E3D76;" href="http://israel.sinaapp.com/trace/signature.php?entity=pondbay" target="_blank">★购买 微信公众平台开发实战教程 点击进入</a> 
<br>
<a style="color: #00BB00;">★微信公众平台技术交流 QQ群317360950； </a> <a style="color: #FF0000;">★公众平台付费外包定制开发 联系QQ 1354386063 </a>




<!-- 多说评论框 start -->
	<div class="ds-thread" data-thread-key="pondbaystudio" data-title="微信公众平台开发" data-url="http://www.cnblogs.com/txw1958/" id="ds-thread"><div id="ds-reset"><div class="ds-meta" style="display: none;"><a href="javascript:void(0)" class="ds-like-thread-button ds-rounded"><span class="ds-icon ds-icon-heart"></span> <span class="ds-thread-like-text">喜欢</span><span class="ds-thread-cancel-like">取消喜欢</span></a><span class="ds-like-panel"><span class="ds-highlight">2</span> 人喜欢</span></div><div class="ds-comments-info"><div class="ds-sort"><a class="ds-order-desc ds-current">最新</a><a class="ds-order-asc">最早</a><a class="ds-order-hot">最热</a></div><ul class="ds-comments-tabs"><li class="ds-tab"><a class="ds-comments-tab-duoshuo ds-current" href="javascript:void(0);"><span class="ds-highlight">10</span>条评论</a></li><li class="ds-tab"><a class="ds-comments-tab-weibo" href="javascript:void(0);"><span class="ds-highlight">3</span>条新浪微博</a></li><li class="ds-tab"><a class="ds-comments-tab-qqt" href="javascript:void(0);"><span class="ds-highlight">11</span>条腾讯微博</a></li></ul></div><ul class="ds-comments"><li class="ds-post" data-post-id="1303589781984247892"><div class="ds-post-self" data-post-id="1303589781984247892" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="6653948"><a rel="nofollow author" target="_blank" href="http://t.qq.com/dsfsdf0002008" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6653948&#39;;" title="时尚城市兰溪站"><img src="./Scrapy入门教程_files/50" alt="时尚城市兰溪站"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://t.qq.com/dsfsdf0002008" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6653948&#39;;" rel="nofollow" target="_blank" data-user-id="6653948">时尚城市兰溪站</a></div><p>我想开发这个功能 那个能帮我做呀</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-05T22:52:08+08:00" title="2014年5月5日 下午10:52:08">16小时前</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247890"><div class="ds-post-self" data-post-id="1303589781984247890" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="6652550"><a rel="nofollow author" target="_blank" href="http://weibo.com/2560625531" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6652550&#39;;" title="Subway-lover"><img src="./Scrapy入门教程_files/1" alt="Subway-lover"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://weibo.com/2560625531" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6652550&#39;;" rel="nofollow" target="_blank" data-user-id="6652550">Subway-lover</a></div><p>已购买，期待中</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-05T20:43:37+08:00" title="2014年5月5日 下午8:43:37">19小时前</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247889"><div class="ds-post-self" data-post-id="1303589781984247889" data-thread-id="1303589781984247810" data-root-id="1303589781984247888" data-source="duoshuo"><div class="ds-avatar" data-user-id="3725608"><a rel="nofollow author" target="_blank" href="http://www.cnblogs.com/txw1958/" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=3725608&#39;;" title="方倍工作室"><img src="./Scrapy入门教程_files/100" alt="方倍工作室"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://www.cnblogs.com/txw1958/" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=3725608&#39;;" rel="nofollow" target="_blank" data-user-id="3725608">方倍工作室</a></div><ol id="ds-ctx"><li class="ds-ctx-entry" data-post-id="1303589781984247888"><div class="ds-avatar"><img src="./Scrapy入门教程_files/noavatar_default.png" alt="bhw"></div><div class="ds-ctx-body"><div class="ds-ctx-head">bhw<span class="ds-time" datetime="2014-05-05T16:29:02+08:00" title="2014年5月5日 下午4:29:02">23小时前</span><div class="ds-ctx-nth" title="2014年5月5日 下午4:29:02">1楼</div></div><div class="ds-ctx-content">按组成功群发后，在微信客户端上的历史消息里查不到呀？　　　　　　　<div class="ds-comment-actions"><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a> <a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a> <a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a></div></div></div></li></ol><p>现在是这样子的</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-05T18:09:54+08:00" title="2014年5月5日 下午6:09:54">21小时前</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247888"><div class="ds-post-self" data-post-id="1303589781984247888" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar"><img src="./Scrapy入门教程_files/noavatar_default.png" alt="bhw"></div><div class="ds-comment-body"><div class="ds-comment-header"><span class="ds-user-name" data-qqt-account="">bhw</span></div><p>按组成功群发后，在微信客户端上的历史消息里查不到呀？</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-05T16:29:02+08:00" title="2014年5月5日 下午4:29:02">23小时前</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247886"><div class="ds-post-self" data-post-id="1303589781984247886" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="6647277"><a rel="nofollow author" target="_blank" href="http://weibo.com/zp66" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6647277&#39;;" title="众盼贴剂有限公司"><img src="./Scrapy入门教程_files/1(1)" alt="众盼贴剂有限公司"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://weibo.com/zp66" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6647277&#39;;" rel="nofollow" target="_blank" data-user-id="6647277">众盼贴剂有限公司</a></div><p>不是十分明白，也想折腾一下公众帐号，可自己不会呀！</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-05T12:10:19+08:00" title="2014年5月5日 下午12:10:19">5月5日</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247885"><div class="ds-post-self" data-post-id="1303589781984247885" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="4357337"><img src="./Scrapy入门教程_files/100(1)" alt="浪花飘香"></div><div class="ds-comment-body"><div class="ds-comment-header"><span class="ds-user-name" data-user-id="4357337" data-qqt-account="">浪花飘香</span></div><p>现在不行了，除了java不知道怎么用以外，都试了，不行，</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-05T10:50:19+08:00" title="2014年5月5日 上午10:50:19">5月5日</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247883"><div class="ds-post-self" data-post-id="1303589781984247883" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="6644046"><a rel="nofollow author" target="_blank" href="http://t.qq.com/asd452123" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6644046&#39;;" title="王家剑"><img src="./Scrapy入门教程_files/50(1)" alt="王家剑"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://t.qq.com/asd452123" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6644046&#39;;" rel="nofollow" target="_blank" data-user-id="6644046">王家剑</a></div><p>确实学到很多东西，几年前一直都想学编程开发，但是买回来的书一看就犯困。现在看了师傅的教材简介方便易懂，感觉有少少成就感了。“胸比头大”</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-05T00:56:14+08:00" title="2014年5月5日 上午12:56:14">5月5日</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247882"><div class="ds-post-self" data-post-id="1303589781984247882" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="6078176"><a rel="nofollow author" target="_blank" href="http://www.baidu.com/p/lpy13782947938" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6078176&#39;;" title="lpy13782947938"><img src="./Scrapy入门教程_files/8c236c707931333738323934373933380105.jpg" alt="lpy13782947938"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://www.baidu.com/p/lpy13782947938" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6078176&#39;;" rel="nofollow" target="_blank" data-user-id="6078176">lpy13782947938</a></div><p> <img src="./Scrapy入门教程_files/geili_org.gif" alt="[给力]" title="[给力]" class="ds-smiley"> </p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-04T10:21:08+08:00" title="2014年5月4日 上午10:21:08">5月4日</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247876"><div class="ds-post-self" data-post-id="1303589781984247876" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="6633457"><a rel="nofollow author" target="_blank" href="http://weibo.com/2616189521" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6633457&#39;;" title="腾讯云"><img src="./Scrapy入门教程_files/0" alt="腾讯云"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://weibo.com/2616189521" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=6633457&#39;;" rel="nofollow" target="_blank" data-user-id="6633457">腾讯云</a></div><p>恭喜方总，方总 <img src="./Scrapy入门教程_files/vw_org.gif" alt="[威武]" title="[威武]" class="ds-smiley"> ！！！ <img src="./Scrapy入门教程_files/lovea_org.gif" alt="[爱你]" title="[爱你]" class="ds-smiley"> </p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-04T01:56:11+08:00" title="2014年5月4日 上午1:56:11">5月4日</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li><li class="ds-post" data-post-id="1303589781984247874"><div class="ds-post-self" data-post-id="1303589781984247874" data-thread-id="1303589781984247810" data-root-id="0" data-source="duoshuo"><div class="ds-avatar" data-user-id="3725608"><a rel="nofollow author" target="_blank" href="http://www.cnblogs.com/txw1958/" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=3725608&#39;;" title="方倍工作室"><img src="./Scrapy入门教程_files/100" alt="方倍工作室"></a></div><div class="ds-comment-body"><div class="ds-comment-header"><a class="ds-user-name ds-highlight" data-qqt-account="" href="http://www.cnblogs.com/txw1958/" onclick="this.href=&#39;http://pondbay.duoshuo.com/user-url/?user_id=3725608&#39;;" rel="nofollow" target="_blank" data-user-id="3725608">方倍工作室</a></div><p>开启非常强大的多说评论系统！</p><div class="ds-comment-footer ds-comment-actions"><span class="ds-time" datetime="2014-05-04T01:54:14+08:00" title="2014年5月4日 上午1:54:14">5月4日</span><a class="ds-post-reply" href="javascript:void(0);"><span class="ds-icon ds-icon-reply"></span>回复</a><a class="ds-post-likes" href="javascript:void(0);"><span class="ds-icon ds-icon-like"></span>顶(1)</a><a class="ds-post-repost" href="javascript:void(0);"><span class="ds-icon ds-icon-share"></span>转发</a><a class="ds-post-report" href="javascript:void(0);"><span class="ds-icon ds-icon-report"></span>举报</a></div></div></div></li></ul><div class="ds-paginator" style="display: none;"><div class="ds-border"></div><a data-page="1" href="javascript:void(0);" class="ds-current">1</a></div><a name="respond"></a><div class="ds-login-buttons"><p>社交帐号登录:</p><div class="ds-social-links"><ul class="ds-service-list"><li><a href="http://pondbay.duoshuo.com/login/weibo/" rel="nofollow" class="ds-service-link ds-weibo">微博</a></li><li><a href="http://pondbay.duoshuo.com/login/qq/" rel="nofollow" class="ds-service-link ds-qq">QQ</a></li><li><a href="http://pondbay.duoshuo.com/login/renren/" rel="nofollow" class="ds-service-link ds-renren">人人</a></li><li><a href="http://pondbay.duoshuo.com/login/douban/" rel="nofollow" class="ds-service-link ds-douban">豆瓣</a></li><li><a class="ds-more-services" href="javascript:void(0)">更多»</a></li></ul><ul class="ds-service-list ds-additional-services"><li><a href="http://pondbay.duoshuo.com/login/kaixin/" rel="nofollow" class="ds-service-link ds-kaixin">开心</a></li><li><a href="http://pondbay.duoshuo.com/login/netease/" rel="nofollow" class="ds-service-link ds-netease">网易</a></li><li><a href="http://pondbay.duoshuo.com/login/sohu/" rel="nofollow" class="ds-service-link ds-sohu">搜狐</a></li><li><a href="http://pondbay.duoshuo.com/login/baidu/" rel="nofollow" class="ds-service-link ds-baidu">百度</a></li><li><a href="http://pondbay.duoshuo.com/login/google/" rel="nofollow" class="ds-service-link ds-google">谷歌</a></li></ul></div></div><div class="ds-replybox"><a class="ds-avatar" href="javascript:void(0);" onclick="return false"><img src="./Scrapy入门教程_files/noavatar_default.png" alt=""></a><form method="post"><input type="hidden" name="thread_id" value="1303589781984247810">
<input type="hidden" name="parent_id" value="">
<input type="hidden" name="nonce" value="5368767bf0c16"><div class="ds-textarea-wrapper ds-rounded-top"><textarea name="message" title="Ctrl+Enter快捷提交" placeholder="说点什么吧…"></textarea><pre class="ds-hidden-text"></pre></div><div class="ds-post-toolbar"><div class="ds-post-options ds-gradient-bg"><span class="ds-sync"></span></div><button class="ds-post-button" type="submit">发布</button><div class="ds-toolbar-buttons"><a class="ds-toolbar-button ds-add-emote" title="插入表情"></a></div></div></form></div><p class="ds-powered-by"><a href="http://duoshuo.com/" target="_blank" rel="nofollow">Powered by 多说</a></p></div></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->

<!-- 多说公共JS代码 end --></div>
<div class="clear"></div>
<div id="blog_post_info_block">
<div id="blog_post_info"><div id="BlogPostCategory">分类: <a href="http://www.cnblogs.com/txw1958/category/398980.html">Python</a></div>
<div id="EntryTag"></div>
<div id="green_channel">
绿色通道：
<a href="javascript:void(0);" id="green_channel_digg" onclick="DiggIt(cb_entryId,cb_blogId,1);green_channel_success(this,&#39;谢谢推荐！&#39;);">好文要顶</a>
<a id="green_channel_follow" onclick="c_follow();" href="javascript:void(0);">关注我</a>
<a id="green_channel_favorite" onclick="AddToWz(cb_entryId);return false;" href="javascript:void(0);">收藏该文</a><a id="green_channel_contact" href="http://space.cnblogs.com/msg/send/%e6%96%b9%e5%80%8d%e5%b7%a5%e4%bd%9c%e5%ae%a4" target="_blank">与我联系</a>
<a id="green_channel_weibo" href="javascript:void(0);" title="分享至新浪微博" onclick="ShareToTsina()"><img src="./Scrapy入门教程_files/icon_weibo_24.png" alt=""></a>
</div>
<div id="digg_block">
<div id="author_profile">
<div id="author_profile_info" class="author_profile_info">
<a href="http://home.cnblogs.com/u/txw1958/" target="_blank"><img src="./Scrapy入门教程_files/20131017185242.png" class="author_avatar" alt=""></a>
<div id="author_profile_detail" class="author_profile_info">
<a href="http://home.cnblogs.com/u/txw1958/">方倍工作室</a><br>
<a href="http://home.cnblogs.com/u/txw1958/followees">关注 - 0</a><br>
<a href="http://home.cnblogs.com/u/txw1958/followers">粉丝 - 851</a>
</div>
</div>
<div class="clear"></div>
<div id="author_profile_honor"></div>
<div id="author_profile_follow">
<a href="javascript:void(0);" onclick="c_follow();return false;">+加关注</a>
</div>
</div>
<div id="div_digg">										
	<div class="diggit" onclick="votePost(cb_entryId,&#39;Digg&#39;)"> 
		<span class="diggnum" id="digg_count">7</span>
	</div>
	<div class="buryit" onclick="votePost(cb_entryId,&#39;Bury&#39;)"> 
		<span class="burynum" id="bury_count">0</span>
	</div>
	<div class="clear"></div>	
	<div class="diggword" id="digg_tips">
    (请您对文章做出评价)
    </div>	
</div>
</div></div>
<div class="clear"></div>
<div id="post_next_prev"><a href="http://www.cnblogs.com/txw1958/archive/2012/07/13/2590434.html" class="p_n_p_prefix">« </a> 上一篇：<a href="http://www.cnblogs.com/txw1958/archive/2012/07/13/2590434.html" title="发布于2012-07-13 16:11">如何成为Python高手</a><br><a href="http://www.cnblogs.com/txw1958/archive/2012/07/17/2595664.html" class="p_n_p_prefix">» </a> 下一篇：<a href="http://www.cnblogs.com/txw1958/archive/2012/07/17/2595664.html" title="发布于2012-07-17 18:04">XPath教程</a><br></div>
</div>


		</div>
		<div class="postDesc">posted @ <span id="post-date">2012-07-16 15:55</span> <a href="http://www.cnblogs.com/txw1958/">方倍工作室</a> 阅读(<span id="post_view_count">27634</span>) 评论(<span id="post_comment_count">15</span>)  <a href="http://i.cnblogs.com/EditPosts.aspx?postid=2593744" rel="nofollow">编辑</a> <a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#" onclick="AddToWz(2593744);return false;">收藏</a></div>
	</div>
	<script type="text/javascript">var allowComments=true,isLogined=false,cb_blogId=99079,cb_entryId=2593744,cb_blogApp=currentBlogApp,cb_blogUserGuid='cf14d8e0-c6f4-e011-8ee0-842b2b196315',cb_entryCreatedDate='2012/7/16 15:55:00';loadViewCount(cb_entryId);</script>
	
</div><!--end: topics 文章、评论容器-->
<a name="!comments"></a><div id="blog-comments-placeholder"><div id="comments_pager_top"></div>
<!--done-->
<div class="feedback_area_title">评论列表</div>
<div class="feedbackNoItems"></div>
	

		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2427780" class="layer">#1楼</a><a name="2427780" id="comment_anchor_2427780"></a>  <span class="comment_date">2012-07-16 19:13</span> <a id="a_comment_author_2427780" href="http://www.cnblogs.com/catcat811/" target="_blank">猫之良品</a> <a href="http://space.cnblogs.com/msg/send/%e7%8c%ab%e4%b9%8b%e8%89%af%e5%93%81" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2427780" class="blog_comment_body">scrapy速度很快，我也通过例子写了个下载网站图片的，感觉相当强大。</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2427780,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2427780,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2427780_avatar" style="display:none;">http://pic.cnitblog.com/face/u101558.jpg</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2427834" class="layer">#2楼</a><a name="2427834" id="comment_anchor_2427834"></a>  <span class="comment_date">2012-07-16 21:32</span> <a id="a_comment_author_2427834" href="http://www.cnblogs.com/skynewbie/" target="_blank">魔哥</a> <a href="http://space.cnblogs.com/msg/send/%e9%ad%94%e5%93%a5" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2427834" class="blog_comment_body">学习，真的不错，python不错</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2427834,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2427834,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2427834_avatar" style="display:none;">http://pic.cnitblog.com/face/u335675.jpg?id=28021945</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2427855" class="layer">#3楼</a><a name="2427855" id="comment_anchor_2427855"></a>[<span class="louzhu">楼主</span>]  <span class="comment_date">2012-07-16 22:20</span> <a id="a_comment_author_2427855" href="http://www.cnblogs.com/txw1958/" target="_blank">txw1958</a> <a href="http://space.cnblogs.com/msg/send/txw1958" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2427855" class="blog_comment_body"><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2427780" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,2427780);">@</a>猫之良品<br>我刚学，以后还请多指教</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2427855,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2427855,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2427855_avatar" style="display:none;">http://pic.cnitblog.com/face/340216/20131017185242.png</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2427865" class="layer">#4楼</a><a name="2427865" id="comment_anchor_2427865"></a>  <span class="comment_date">2012-07-16 22:35</span> <a id="a_comment_author_2427865" href="http://www.cnblogs.com/catcat811/" target="_blank">猫之良品</a> <a href="http://space.cnblogs.com/msg/send/%e7%8c%ab%e4%b9%8b%e8%89%af%e5%93%81" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2427865" class="blog_comment_body"><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2427855" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,2427855);">@</a>txw1958<br>我也是，不过scrapy还算比较简单的。</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2427865,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2427865,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2427865_avatar" style="display:none;">http://pic.cnitblog.com/face/u101558.jpg</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2428267" class="layer">#5楼</a><a name="2428267" id="comment_anchor_2428267"></a>  <span class="comment_date">2012-07-17 13:38</span> <a id="a_comment_author_2428267" href="http://www.cnblogs.com/crazyant/" target="_blank">请叫我哈哈哥</a> <a href="http://space.cnblogs.com/msg/send/%e8%af%b7%e5%8f%ab%e6%88%91%e5%93%88%e5%93%88%e5%93%a5" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2428267" class="blog_comment_body">scrapy能使用cookie吗，能抓动态加载的内容，比如微博吗</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2428267,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2428267,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2428267_avatar" style="display:none;">http://pic.cnitblog.com/face/u275232.jpg?id=29160949</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2429047" class="layer">#6楼</a><a name="2429047" id="comment_anchor_2429047"></a>[<span class="louzhu">楼主</span>]  <span class="comment_date">2012-07-18 12:00</span> <a id="a_comment_author_2429047" href="http://www.cnblogs.com/txw1958/" target="_blank">txw1958</a> <a href="http://space.cnblogs.com/msg/send/txw1958" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2429047" class="blog_comment_body"><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2428267" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,2428267);">@</a>请叫我哈哈哥<br>应该可以，不过没试过</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2429047,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2429047,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2429047_avatar" style="display:none;">http://pic.cnitblog.com/face/340216/20131017185242.png</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2529515" class="layer">#7楼</a><a name="2529515" id="comment_anchor_2529515"></a>  <span class="comment_date">2012-11-11 23:31</span> <a id="a_comment_author_2529515" href="http://home.cnblogs.com/u/442442/" target="_blank">crifan</a> <a href="http://space.cnblogs.com/msg/send/crifan" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2529515" class="blog_comment_body"><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2428267" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,2428267);">@</a>请叫我哈哈哥<br>可以的。<br>具体可以使用<br><a href="http://doc.scrapy.org/en/latest/topics/downloader-middleware.html#built-in-downloader-middleware-reference" target="_blank">Built-in downloader middleware reference</a></div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2529515,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2529515,&#39;Bury&#39;,this)">反对(0)</a></div>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2559468" class="layer">#8楼</a><a name="2559468" id="comment_anchor_2559468"></a>  <span class="comment_date">2012-11-22 15:22</span> <a id="a_comment_author_2559468" href="http://www.cnblogs.com/myme5261314/" target="_blank">九江北</a> <a href="http://space.cnblogs.com/msg/send/%e4%b9%9d%e6%b1%9f%e5%8c%97" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2559468" class="blog_comment_body">定义Item<br><br>Items是将要装载抓取的数据的容器，它工作方式像python里面的字典，但它提供更多的保护，比如对未定义的字段填充以防止拼写错误。<br><br>它通过创建一个<b>scrapy</b>.item.Item类来声明，定义它的属性为<b>scrpiy</b>.item.Field对象，就像是一个对象关系映射(ORM). <br><br>scrpiy是不是写错了？</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2559468,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2559468,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2559468_avatar" style="display:none;">http://pic.cnitblog.com/face/u427015.png?id=13152011</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2560856" class="layer">#9楼</a><a name="2560856" id="comment_anchor_2560856"></a>[<span class="louzhu">楼主</span>]  <span class="comment_date">2012-11-23 14:14</span> <a id="a_comment_author_2560856" href="http://www.cnblogs.com/txw1958/" target="_blank">txw1958</a> <a href="http://space.cnblogs.com/msg/send/txw1958" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2560856" class="blog_comment_body"><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2559468" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,2559468);">@</a>九江北 是的，已经更新了</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2560856,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2560856,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2560856_avatar" style="display:none;">http://pic.cnitblog.com/face/340216/20131017185242.png</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2611108" class="layer">#10楼</a><a name="2611108" id="comment_anchor_2611108"></a>  <span class="comment_date">2013-01-30 22:14</span> <a id="a_comment_author_2611108" href="http://home.cnblogs.com/u/62556/" target="_blank">Presto...</a> <a href="http://space.cnblogs.com/msg/send/Presto..." title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2611108" class="blog_comment_body">初学者<br>先看看<b>DIP</b><br>然后继续读这篇文章<br>python<br>有点意思啊<br>多谢分享这么好的文章</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2611108,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2611108,&#39;Bury&#39;,this)">反对(0)</a></div>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2670042" class="layer">#11楼</a><a name="2670042" id="comment_anchor_2670042"></a>  <span class="comment_date">2013-04-30 22:34</span> <a id="a_comment_author_2670042" href="http://home.cnblogs.com/u/523279/" target="_blank">chu8129</a> <a href="http://space.cnblogs.com/msg/send/chu8129" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2670042" class="blog_comment_body">比如说我要在微博上搜素包含‘’国民经济‘’这个关键字的微博或者评论并且要下载这些文字下来，那应该怎么做？我不是计算机专业的，能不能给个简单易懂的思路？等着您的回复</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2670042,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2670042,&#39;Bury&#39;,this)">反对(0)</a></div>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2671114" class="layer">#12楼</a><a name="2671114" id="comment_anchor_2671114"></a>[<span class="louzhu">楼主</span>]  <span class="comment_date">2013-05-02 19:01</span> <a id="a_comment_author_2671114" href="http://www.cnblogs.com/txw1958/" target="_blank">方倍工作室</a> <a href="http://space.cnblogs.com/msg/send/%e6%96%b9%e5%80%8d%e5%b7%a5%e4%bd%9c%e5%ae%a4" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2671114" class="blog_comment_body"><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2670042" title="查看所回复的评论" onclick="commentManager.renderComments(0,50,2670042);">@</a>chu8129 微博可以，评论不行，你抓取搜索页面结果就行了。</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2671114,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2671114,&#39;Bury&#39;,this)">反对(0)</a></div><span id="comment_2671114_avatar" style="display:none;">http://pic.cnitblog.com/face/340216/20131017185242.png</span>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2882691" class="layer">#13楼</a><a name="2882691" id="comment_anchor_2882691"></a>  <span class="comment_date">2014-02-25 17:32</span> <a id="a_comment_author_2882691" href="http://home.cnblogs.com/u/490821/" target="_blank">杨高明</a> <a href="http://space.cnblogs.com/msg/send/%e6%9d%a8%e9%ab%98%e6%98%8e" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2882691" class="blog_comment_body">最新的scrapy有改动，去除了select函数，改为了xpath函数。所以hxs.select('//ul/li')实验失败。<br>参考：<br><a href="http://doc.scrapy.org/en/latest/topics/selectors.html" target="_blank">http://doc.scrapy.org/en/latest/topics/selectors.html</a><br>应该是这样的：<br>from scrapy.selector import Selector<br>sel = Selector(response)<br>sel.xpath('//title')</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2882691,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2882691,&#39;Bury&#39;,this)">反对(0)</a></div>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2891403" class="layer">#14楼</a><a name="2891403" id="comment_anchor_2891403"></a>  <span class="comment_date">2014-03-09 21:01</span> <a id="a_comment_author_2891403" href="http://home.cnblogs.com/u/611305/" target="_blank">zhuhuangjian</a> <a href="http://space.cnblogs.com/msg/send/zhuhuangjian" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2891403" class="blog_comment_body">博主,我的这儿出现 exceptions.AttributeError: 'HtmlXPathSelector' object has no attribute 'path '  这个问题!这是为什么?</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2891403,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2891403,&#39;Bury&#39;,this)">反对(0)</a></div>
			</div>
		</div>
	
		<div class="feedbackItem">
			<div class="feedbackListSubtitle">
				<div class="feedbackManage">
					&nbsp;&nbsp;<span class="comment_actions"></span>
				</div>
				<a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#2908087" class="layer">#15楼</a><a name="2908087" id="comment_anchor_2908087"></a><span id="comment-maxId" style="display:none;">2908087</span><span id="comment-maxDate" style="display:none;">2014/3/31 15:27:50</span>  <span class="comment_date">2014-03-31 15:27</span> <a id="a_comment_author_2908087" href="http://www.cnblogs.com/onlyforcloud/" target="_blank">Lawrence.Lau</a> <a href="http://space.cnblogs.com/msg/send/Lawrence.Lau" title="发送站内短消息" class="sendMsg2This">&nbsp;</a>
			</div>
			<div class="feedbackCon">
				<div id="comment_body_2908087" class="blog_comment_body">请问怎么改User-Agent呢？有些站点响应403</div><div class="comment_vote"><a href="javascript:void(0);" class="comment_digg" onclick="return voteComment(2908087,&#39;Digg&#39;,this)">支持(0)</a><a href="javascript:void(0);" class="comment_bury" onclick="return voteComment(2908087,&#39;Bury&#39;,this)">反对(0)</a></div>
			</div>
		</div>
	<div id="comments_pager_bottom"></div></div><script type="text/javascript">var commentManager = new blogCommentManager();commentManager.renderComments(0);</script>
<div id="comment_form" class="commentform">
<a name="commentform"></a>
<div id="divCommentShow"></div>
<div id="comment_nav"><span id="span_refresh_tips"></span><a href="javascript:void(0);" id="lnk_RefreshComments" onclick="return RefreshCommentList();">刷新评论</a><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#" onclick="return RefreshPage();">刷新页面</a><a href="http://www.cnblogs.com/txw1958/archive/2012/07/16/scrapy-tutorial.html#top">返回顶部</a></div>
<div id="comment_form_container"><div class="login_tips">注册用户登录后才能发表评论，请 <a rel="nofollow" href="javascript:void(0);" class="underline" onclick="return login(&#39;commentform&#39;);">登录</a> 或 <a rel="nofollow" href="javascript:void(0);" class="underline" onclick="return register();">注册</a>，<a href="http://www.cnblogs.com/">访问</a>网站首页。</div></div>
<div class="ad_text_commentbox" id="ad_text_under_commentbox"></div>
<div id="site_nav_under"><a href="http://www.cnblogs.com/" target="_blank" title="程序员的网上家园">博客园首页</a><a href="http://q.cnblogs.com/" target="_blank" title="程序员问答社区">博问</a><a href="http://news.cnblogs.com/" target="_blank" title="IT新闻">新闻</a><a href="http://home.cnblogs.com/ing/" target="_blank">闪存</a><a href="http://job.cnblogs.com/" target="_blank">程序员招聘</a><a href="http://kb.cnblogs.com/" target="_blank">知识库</a></div>
<div id="ad_under_post_holder">

<div id="google_ad_c1" class="c_ad_block">
    <!-- cnblogs_blogpost_C1_sitehome -->
    <div id="div-gpt-ad-1346480159711-0" style="width:300px; height:250px;">
    
    <div id="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0__container__" style="border: 0pt none;"><iframe id="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0" name="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0" width="300" height="250" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:"<html><body style='background:transparent'></body></html>"" style="border: 0px; vertical-align: bottom;"></iframe></div><iframe id="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0__hidden__" name="google_ads_iframe_/1090369/cnblogs_blogpost_C1_sitehome_0__hidden__" width="0" height="0" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" src="javascript:"<html><body style='background:transparent'></body></html>"" style="border: 0px; vertical-align: bottom; visibility: hidden; display: none;"></iframe></div>
</div>
<div id="blog_news_kb"><div class="itnews c_ad_block"><b>最新IT新闻</b>:<br> ·  <a href="http://news.cnblogs.com/n/207244/" target="_blank">遇见程序员男友</a><br> ·  <a href="http://news.cnblogs.com/n/207243/" target="_blank">山寨电视盒为何满天飞？</a><br> ·  <a href="http://news.cnblogs.com/n/207242/" target="_blank">还敢赖账？法院从支付宝划扣罚款</a><br> ·  <a href="http://news.cnblogs.com/n/207241/" target="_blank">苹果扩大医学技术专家团队 或为iWatch计划准备</a><br> ·  <a href="http://news.cnblogs.com/n/207240/" target="_blank">Aspose.Pdf for .NET添加附件到PDF文档</a><br>» <a href="http://news.cnblogs.com/" title="IT新闻" target="_blank">更多新闻...</a></div><div class="itnews c_ad_block" id="kb_block"><b>最新知识库文章</b>:<br><div id="kb_recent"> ·  <a href="http://kb.cnblogs.com/page/207086/" target="_blank">当随机不够随机：一个在线扑克游戏的教训</a><br> ·  <a href="http://kb.cnblogs.com/page/177108/" target="_blank">闭包漫谈（从抽象代数及函数式编程角度）</a><br> ·  <a href="http://kb.cnblogs.com/page/193450/" target="_blank">Facebook和Google如何激发工程师的创造力</a><br> ·  <a href="http://kb.cnblogs.com/page/192941/" target="_blank">好的程序员到底好在哪里？</a><br> ·  <a href="http://kb.cnblogs.com/page/206478/" target="_blank">关于坐标系和投影的相关知识探讨</a><br></div>» <a href="http://kb.cnblogs.com/" target="_blank">更多知识库文章...</a></div></div></div>
<script type="text/javascript">
var enableGoogleAd = true;
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
fixPostBodyFormat();
loadAdUnderPost();
</script>
<div id="HistoryToday" class="c_ad_block"></div>
<script type="text/javascript">
loadBlogSignature();
LoadPostInfoBlock(cb_blogId, cb_entryId, cb_blogApp, cb_blogUserGuid);
GetPrevNextPost(cb_entryId, cb_blogId, cb_entryCreatedDate);
GetHistoryToday(cb_blogId, cb_blogApp, cb_entryCreatedDate);
</script>
<script type="text/javascript">
    $.ajax({ url: 'http://counter.cnblogs.com/blog/post/' + cb_entryId, type: 'get', dataType: 'script', cache: true });
</script>
</div>

	</div><!--end: forFlow -->
	</div><!--end: mainContent 主体内容容器-->

	<div id="sideBar">
		<div id="sideBarMain">
			
<!--done-->
<div class="newsItem">
<h3 class="catListTitle">公告</h3>
	<div id="blog-news"><div>
<p style="padding-left:30px">
<a href="http://israel.sinaapp.com/trace/bulletin.php?entity=practice" target="_blank">
<img src="./Scrapy入门教程_files/301756448922305.jpg" width="135" height="192"></a>
</p>
<p>
<strong style="color: red;"><span>《微信公众平台开发最佳实践》</span></strong>
</p>
</div>
<div>
<span style="font-size: 9pt;">案例最多：</span>
<span style="font-size: 9pt; color: #0000ff;">超过30个应用核心代码</span>
</div>
<div>
<span style="font-size: 9pt;">内容最全：</span>
<span style="font-size: 9pt; color: #0000ff;">覆盖微信五大体系接口</span>
</div>
<div>
<span style="font-size: 9pt;">专家推荐：</span>
<span style="font-size: 9pt; color: #0000ff;">O2O第一媒体CEO推荐</span>
</div>
<div>
<span style="font-size: 9pt;">经典语言：</span>
<span style="font-size: 9pt; color: #0000ff;">使用PHP+MySQL编写</span>
</div>
<div>
<span style="font-size: 9pt;">最受欢迎：</span>
<span style="font-size: 9pt; color: #0000ff;">入门教程达20万阅读量</span>
</div>
<div>
<span style="font-size: 9pt;">帮助成功：</span>
<span style="font-size: 9pt; color: #0000ff;">去年就已有学生赚几千</span>
</div>
<div>
<p>
<strong style="color: red;"><span>购买方式</span></strong> <span style="color: #808080;">点击下面图标购买
</span></p>
</div>
<div>
<span>
<a href="http://israel.sinaapp.com/trace/bulletin.php?entity=dangdang" target="_blank">
<img src="./Scrapy入门教程_files/302113235486194.jpg" alt="">
</a>
</span>
<span>
<a href="http://israel.sinaapp.com/trace/bulletin.php?entity=jd" target="_blank">
<img src="./Scrapy入门教程_files/302113112983585.jpg" alt=""></a>
</span>
</div>
<p>&nbsp;</p>
<div style="display:none">
<div style="display: none" id="__document_write_ajax_div-6"></div></div>


<div style="display: none" id="__document_write_ajax_div-2"></div>
<wb:follow-button uid="1722657290" type="red_3" width="100%" height="24"></wb:follow-button><div id="profile_block">昵称：<a href="http://home.cnblogs.com/u/txw1958/">方倍工作室</a><br>园龄：<a href="http://home.cnblogs.com/u/txw1958/" title="入园时间：2011-10-12">2年6个月</a><br>粉丝：<a href="http://home.cnblogs.com/u/txw1958/followers/">851</a><br>关注：<a href="http://home.cnblogs.com/u/txw1958/followees/">0</a><div id="p_b_follow"></div><div style="display: none" id="__document_write_ajax_div-3"></div></div></div><script type="text/javascript">loadBlogNews();</script>
</div>

			<div id="calendar"><div id="blog-calendar" style="display:none"></div><script type="text/javascript">loadBlogDefaultCalendar();</script></div>
			
			<div id="leftcontentcontainer">
				<div id="blog-sidecolumn">

<div class="mySearch">
<h3 class="catListTitle">搜索</h3>
<div id="widget_my_zzk" class="div_my_zzk"><input type="text" id="q" onkeydown="return zzk_go_enter(event);" class="input_my_zzk">&nbsp;<input onclick="zzk_go()" type="button" value="找找看" id="btnZzk" class="btn_my_zzk"></div>

</div>


<div class="catListEssay">
<h3 class="catListTitle">最新随笔</h3>
<ul>
<li><a href="http://www.cnblogs.com/txw1958/p/3710625.html">1. 张小龙浅谈微信公众平台的意义</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-public-course-beijing.html">2. 微信公开课（北京站）速记 微信、微信支付、O2O的定义与关联</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-hideOptionMenu-hideToolbar-getNetworkType.html">3. 微信公众平台开发(91) 右上角按钮/底部导航栏/用户网络状态</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin89-mass-send.html">4. 微信公众平台开发(89) 高级群发接口</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-user-group-manage.html">5. 微信公众平台开发(88) 用户分组接口</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-get-follower-list.html">6. 微信公众平台开发(87) 获取关注者列表</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-get-user-basic-info.html">7. 微信公众平台开发(86) 获取用户基本信息</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin--get-user-geographic-position.html">8. 微信公众平台开发(85) 获取用户地理位置</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-mp-mass-send.html">9. 微信公众平台高级群发接口</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-business-group.html">10. 腾讯微信事业群</a></li>
</ul>
</div>

<div class="catListPostCategory">
<h3 class="catListTitle">随笔分类<span style="font-size:11px;font-weight:normal">(217)</span></h3>

<ul>

<li><a id="ctl02_CatList_LinkList_0_Link_0" href="http://www.cnblogs.com/txw1958/category/545892.html">高级接口(17)</a> </li>

<li><a id="ctl02_CatList_LinkList_0_Link_1" href="http://www.cnblogs.com/txw1958/category/545893.html">开发教程(7)</a> </li>

<li><a id="ctl02_CatList_LinkList_0_Link_2" href="http://www.cnblogs.com/txw1958/category/545894.html">微信动态(35)</a> </li>

<li><a id="ctl02_CatList_LinkList_0_Link_3" href="http://www.cnblogs.com/txw1958/category/407134.html">微信开发(148)</a> </li>

<li><a id="ctl02_CatList_LinkList_0_Link_4" href="http://www.cnblogs.com/txw1958/category/545895.html">微信认证(2)</a> </li>

<li><a id="ctl02_CatList_LinkList_0_Link_5" href="http://www.cnblogs.com/txw1958/category/545896.html">移动支付(8)</a> </li>

</ul>

</div>

<div class="catList">
<h3 class="catListTitle">微信导航</h3>

<ul>

<li><a id="ctl02_CatList_LinkList_1_Link_0" rel="nofollow" href="http://www.cnblogs.com/txw1958/p/wechat-tutorial.html" target="_blank">微信公众平台开发入门教程</a> </li>

<li><a id="ctl02_CatList_LinkList_1_Link_1" rel="nofollow" href="http://www.cnblogs.com/txw1958/p/weixin-58-custom-menu.html" target="_blank">微信公众平台开发自定义菜单</a> </li>

<li><a id="ctl02_CatList_LinkList_1_Link_2" rel="nofollow" href="http://www.cnblogs.com/txw1958/p/weixin-development-best-practice.html" target="_blank">微信公众平台开发最佳实践</a> </li>

</ul>

</div>

<div class="catList">
<h3 class="catListTitle">友情链接</h3>

<ul>

<li><a id="ctl02_CatList_LinkList_2_Link_0" rel="nofollow" href="http://www.helloweba.com/" target="_blank">helloweba</a> </li>

<li><a id="ctl02_CatList_LinkList_2_Link_1" rel="nofollow" href="http://www.highcharts.com/" target="_blank">Highcharts</a> </li>

</ul>

</div>


<div class="catListView">
<h3 class="catListTitle">阅读排行榜</h3>
	<div id="TopViewPostsBlock"><ul><li><a href="http://www.cnblogs.com/txw1958/p/wechat-tutorial.html">1. 微信公众平台开发入门教程(211542)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/01/24/weixin-if1-enable.html">2. 微信公众平台消息接口开发（1）启用接口(69340)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/01/31/weixin-if2-enable.html">3. 你的服务器没有正确响应Token验证的解决方法(43898)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2012/08/01/csharp-json.html">4. C#解析json文件的方法(38569)</a></li><li><a href="./Scrapy入门教程_files/Scrapy入门教程.htm">5. Scrapy入门教程(27634)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/03/14/weixin-if0-api.html">6. 微信公众平台消息接口API指南(26984)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2012/09/24/CSharp-WebBrowser.html">7. C#中的WebBrowser控件的使用(24935)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/02/07/weixin-if8-simsimi.html">8. 微信公众平台消息接口开发（8）小黄鸡(小贱鸡)机器人(24173)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2011/10/13/ip_address_regular_expression.html">9. IP地址的正则表达式(21639)</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin71-oauth20.html">10. 微信公众平台开发（71）OAuth2.0网页授权(20407)</a></li></ul></div>
</div>

<div class="catListFeedback">
<h3 class="catListTitle">评论排行榜</h3>
	<div id="TopFeedbackPostsBlock"><ul><li><a href="http://www.cnblogs.com/txw1958/p/wechat-tutorial.html">1. 微信公众平台开发入门教程(64)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2012/11/06/programmer-personal-work.html">2. 程序员接私活经验谈[转](54)</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-api100.html">3. 接口100(39)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/02/26/weixin-if50-music.html">4. 微信公众平台消息接口开发（50）在线点歌/在线音乐(33)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/02/07/weixin-if8-simsimi.html">5. 微信公众平台消息接口开发（8）小黄鸡(小贱鸡)机器人(33)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/01/09/guchengzhonglou-weibo-timer.html">6. 古城钟楼微博地支报时程序铛，100行代码实现，价值一天20万粉丝(32)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/01/24/weixin-if1-enable.html">7. 微信公众平台消息接口开发（1）启用接口(25)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/03/13/weixin-if24-face-recognize-api.html">8. 微信公众平台消息接口开发（24）图片识别之人脸识别API(21)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2011/10/13/ip_address_regular_expression.html">9. IP地址的正则表达式(16)</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin76-user-info.html">10. 微信公众平台开发(76) 无高级接口账号获取用户基本信息(15)</a></li></ul></div>
</div>

<div class="catListView">
<h3 class="catListTitle">推荐排行榜</h3>
<div id="TopDiggPostsBlock"><ul><li><a href="http://www.cnblogs.com/txw1958/archive/2012/11/06/programmer-personal-work.html">1. 程序员接私活经验谈[转](32)</a></li><li><a href="http://www.cnblogs.com/txw1958/p/wechat-tutorial.html">2. 微信公众平台开发入门教程(27)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2012/08/01/csharp-json.html">3. C#解析json文件的方法(9)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/01/09/guchengzhonglou-weibo-timer.html">4. 古城钟楼微博地支报时程序铛，100行代码实现，价值一天20万粉丝(9)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/01/24/weixin-if1-enable.html">5. 微信公众平台消息接口开发（1）启用接口(9)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/01/27/csharp-calendar.html">6. C#实现万年历(农历、节气、节日、星座、星宿、属相、生肖、闰年月、时辰)(8)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2012/09/03/csharp-thread-1.html">7. C#中的线程（一）入门(7)</a></li><li><a href="./Scrapy入门教程_files/Scrapy入门教程.htm">8. Scrapy入门教程(7)</a></li><li><a href="http://www.cnblogs.com/txw1958/p/weixin-weather-forecast.html">9. 微信公众平台开发(82)  天气预报(5)</a></li><li><a href="http://www.cnblogs.com/txw1958/archive/2013/03/12/weixin-if9-CustomizeMenus.html">10. 微信公众平台消息接口开发（9）骑行西藏自定义菜单(4)</a></li></ul></div>
</div></div><script type="text/javascript">loadBlogSideColumn();</script>
			</div>
			
		</div><!--end: sideBarMain -->
	</div><!--end: sideBar 侧边栏容器 -->
	<div class="clear"></div>
	</div><!--end: main -->
	<div class="clear"></div>
	<div id="footer">
		
<!--done-->
Copyright ©2014 方倍工作室
	</div><!--end: footer -->
</div><!--end: home 自定义的最大容器 -->
<!--PageEndHtml Block Begin-->
<div style="display:none;">
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F674430fbddd66a488580ec86aba288f7' type='text/javascript'%3E%3C/script%3E"));
</script><script src="./Scrapy入门教程_files/h.js" type="text/javascript"></script><a href="http://tongji.baidu.com/hm-web/welcome/ico?s=674430fbddd66a488580ec86aba288f7" target="_blank"><img border="0" src="./Scrapy入门教程_files/21.gif" width="20" height="20"></a>
</div>
<!--PageEndHtml Block End-->


<iframe id="google_osd_static_frame_7477102200500" name="google_osd_static_frame" style="display: none; width: 0px; height: 0px;"></iframe></body></html>